home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / util / syserror.sit.hqx / SysErrors Documentation.rsrc / TEXT_130.txt < prev    next >
Text File  |  1997-08-12  |  2KB  |  69 lines

  1.  
  2. Resource Editing (Rolling your own error tables)
  3.  
  4. Using ResEdit and Resorcerer
  5. I'm assuming that you've used a resource editing tool before, if you haven't this isn't a lesson, sorry.
  6.  
  7. The Error tables are held in resources of type 'eTAB'. The resource number doesn't matter, but the resource name is used in the menus. Make sure that you don't have multiple resources with the same name, the menu selections may become confused. The template that is supplied in the application resource fork for the error tables is compatible with both ResEdit and Resorcerer. 
  8.  
  9. Possible problems you may encounter...
  10. ResEdit may not be able to open exceptionally large tables, ie, greater than 16k.
  11. If you add masses of error tables you may need to increase the application memory allowance.
  12.  
  13. Using a resource compiler
  14. There's one in every development environment, MPW has Rez, both Symantec and CodeWarrior have built in compilers. There's a version called SARez kicking about somewhere. I think it used to be supplied with Think C.
  15.  
  16. Here's the resource definition, you should be able to copy it from here and stick it in a file called 'eTAB.r' or something similar.
  17.  
  18. /*--------------------------------------------------------------------
  19.  
  20.     Copyright¬© 1997 CPTech (Southern) Ltd. All rights reserved
  21.  
  22. ----------------------------------------------------------------------*/
  23. #define keTABVersion        0x0100
  24.  
  25. /*
  26. ** Error table resource description
  27. */
  28. type 'eTAB' {
  29.     integer;                                            // Version of resource.
  30.  
  31.     pstring;                                            // Error Type.
  32.     align word;
  33.  
  34.     integer = $$Countof(ErrorArray);
  35.     array ErrorArray {
  36.         integer;                                        // Error number.
  37.         pstring;                                        // Terse error string or mnemonic.
  38.         align word;
  39.         pstring;                                        // Verbose error description.
  40.         align word;
  41.     };
  42. };
  43.  
  44.  
  45. Here's an example of the resource to be compiled, again you can copy it out to use as a template.
  46.  
  47. /*--------------------------------------------------------------------
  48.  
  49.     Copyright¬© 1997 CPTech (Southern) Ltd. All rights reserved
  50.  
  51. ----------------------------------------------------------------------*/
  52. #include "eTAB.r"
  53.  
  54. resource 'eTAB' (141,"Scrap Manager", locked, preload)                
  55. {                
  56.     keTABVersion,            
  57.     "OSErr",            
  58.     {            
  59.       // number, "error mnemonic", "Error description",
  60.  
  61.         -100    ,"noScrapErr",    "No scrap exists error",
  62.         -102    ,"noTypeErr",    "No object of that type in scrap",
  63.     }            
  64. };
  65.  
  66.  
  67.  
  68.  
  69.